# Maintainer: Anatol Pomozov <anatol.pomozov@gmail.com>

pkgname=mruby
pkgver=3.2.0
pkgrel=1
pkgdesc='An interpreter for the Ruby programming language with the intention of being lightweight and easily embeddable'
arch=(loong64 x86_64)
url='https://github.com/mruby/mruby'
license=(MIT)
depends=(readline)
makedepends=(bison ruby ruby-rake)
source=(mruby-$pkgver.zip::https://github.com/mruby/mruby/archive/$pkgver.zip)
sha256sums=('64a0dd8b65825f2e7cdac6699e818648dc73bfdfc68aa1bfd58417a35315e5cc')

build() {
  cd mruby-$pkgver
  CFLAGS+=" -ffat-lto-objects" \
  make
}

check() {
  cd mruby-$pkgver
  # make test disable due to https://github.com/mruby/mruby/issues/5026
}

package() {
  cd mruby-$pkgver

  install -d "$pkgdir/usr/bin" "$pkgdir/usr/lib" "$pkgdir/usr/share/licenses/mruby"
  cp build/host/bin/* "$pkgdir/usr/bin"
  cp build/host/lib/*.a "$pkgdir/usr/lib"
  cp -r include "$pkgdir/usr"

  cp LICENSE "$pkgdir/usr/share/licenses/mruby/LICENSE"
}
